<?php
  require_once('scripts/restrict_access.php'); 
  $sql = 'SELECT dbName,dbID,dbDescription FROM `databases` WHERE `accountId`= ? ORDER BY dbName';
  $result = $dbRead->fetchAll($sql,$_SESSION['accountId']);
  $size_of_result = sizeof($result); 
?> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--

Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Title      : Complimentary
Version    : 1.0
Released   : 20080409
Description: A two-column, fixed-width and lightweight template ideal for 1024x768 resolutions. Suitable for blogs and small websites.

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Databases List</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="CSS/ComplementaryDefault.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<!-- start header -->
<div id="header">
<div id="logo">
    <h1><a href="#">Find-it</a> </h1>
  </div>
  <div id="menu">
    <div id="buttons">
      <ul>
       
        <li> <a href="AddDataBase.php">New Catalog</a></li>        
        </li>
        <li><a href="UserList.php">Users </a></li>
        <li></li>
        <li><a href="ReportList.php">Reports</a></li>
        <li><a href="Index.php?logout">Logout </a></li>
      </ul>
    </div>
  </div>
</div>
<!-- end header -->
<!-- start page -->
<div id="page"> 
  <!-- start content -->
  <div id="content">
    <div class="post">
      <p><br />
      </p>
      <h1 class="title">Your Catalogs</h1>
      
       <!--Display captured error messages and warnings -->
        <p><br/>
        <span class="warning">
         <?php require_once('scripts/msg_DBMain.php'); ?>        
        </span></p>  

<table width="100%">
        <tr>
          <td width="25%"><h3>Catalog Name</h3></td>
          <td width="65%"><h3>Catalog Description</h3></td>
          <td width="10%"><h3>Edit Catalog</h3></td>
        </tr>       
          <?php 	      
		   for ($i=0; $i<$size_of_result; $i++){			   		   
		   ?>
        <tr>
          <td><a href="DBMain.php?dbId=<?php echo $result[$i]['dbID'];?>&amp;name=<?php echo urlencode($result[$i]['dbName']);?>">
		      <?php echo $result[$i]['dbName']; ?> </a></td>
          <td><?php echo $result[$i]['dbDescription']; ?></td>
          <td><a href="EditCatalog.php?dbId=<?php echo $result[$i]['dbID'];?>&amp;name=<?php echo urlencode($result[$i]['dbName']);?>">Edit</a></td>
        </tr><?php } ?>
      </table>
      <!-- The bottomSpace div is for reserving space at the bottom for the footer -->
        <div class="bottomSpace">
          <p><br /><br />
          </p>
        </div>
    </div>
  </div>
  <!-- end content --> 
  <!-- start sidebar --><!-- end sidebar -->
  <div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
<!-- start footer -->
<div id="footer">
  <p id="legal">(c) 2012 Find-It. Design by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.<br />
	</p>
</div>
<!-- end footer -->
</body>
</html>
